package org.jeecg.modules.system.job;

import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.system.mapper.CallProcedure;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

@Slf4j
public class CallProcedureJob implements Job {

    @Autowired
    private CallProcedure callProcedure;

    private String parameter;

    public void setParameter(String parameter) {
        this.parameter = parameter;
    }

    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        log.info(String.format(" 执行存储过程"+this.parameter+":" + DateUtils.getTimestamp()));
        try{
            callProcedure.CallProcedure(this.parameter);
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
